﻿using Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;

namespace EFCore.Configers
{
    public class UserConfigers : IEntityTypeConfiguration<User>
    {
        public void Configure(EntityTypeBuilder<User> builder)
        {
            builder.ToTable(nameof(User));
            builder.Property(x => x.UName).IsRequired().HasMaxLength(50);
            builder.Property(x => x.UTrueName).IsRequired().HasMaxLength(50);
            builder.Property(x => x.UPassWord).IsRequired().HasMaxLength(50);
           
            builder.HasData(new User()
            {
                UId = 1,
                UName = "admin",
                UTrueName = "管理员",
                UPassWord = "123456"
            }, new User()
            {
                UId = 2,
                UName = "wan",
                UTrueName = "万岳军",
                UPassWord = "123456"
            }
            );
        }
    }
}
